package com.bx.implatform.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.bx.implatform.entity.secondary.SecondaryAdmin;
import com.bx.implatform.entity.secondary.SecondaryAdminRole;
import com.bx.implatform.mapper.secondary.SecondaryAdminMapper;
import com.bx.implatform.mapper.secondary.SecondaryAdminRoleMapper;
import com.bx.implatform.service.SecondaryAdminRoleService;
import com.bx.implatform.service.SecondaryAdminService;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

@Slf4j
@Service
@RequiredArgsConstructor
public class SecondaryAdminRoleServiceImpl extends ServiceImpl<SecondaryAdminRoleMapper, SecondaryAdminRole> implements SecondaryAdminRoleService {

    @Override
    public SecondaryAdminRole findRoleByUserId(Integer userId) {
        LambdaQueryWrapper<SecondaryAdminRole> queryWrapper = Wrappers.lambdaQuery();
        queryWrapper.like(SecondaryAdminRole::getUserId, userId);
        return this.getOne(queryWrapper);
    }

}
